package com.example.mqtt.controller;

import com.example.mqtt.model.DataEntry;
import com.example.mqtt.service.DataService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/data")
@RequiredArgsConstructor
public class DataController {

    private final DataService dataService;

    @CrossOrigin
    @GetMapping
    public List<DataEntry> getData() {
        return dataService.getData();
    }
}